package com.ml.doctor.activity;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.google.gson.reflect.TypeToken;
import com.ml.doctor.R;
import com.ml.doctor.adapter.MyServiceRecyclerAdapter;
import com.ml.doctor.bean.MyServiceBean;
import com.ml.doctor.bean.PatientBean;
import com.ml.doctor.network.NetworkApi;
import com.ml.doctor.network.NetworkManager;
import com.ml.doctor.utils.LocalShared;
import com.ml.doctor.utils.ToastUtil;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class MyServiceActivity extends BaseActivity {
    private ArrayList<MyServiceBean> mServiceBean = new ArrayList<>();
    private MyServiceRecyclerAdapter mAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_service);
        setTopTitle("我的服务");
        RecyclerView mRecyclerView = (RecyclerView) findViewById(R.id.rv_my_service);
        mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext));
        mAdapter = new MyServiceRecyclerAdapter(mContext, mServiceBean);
        mRecyclerView.setAdapter(mAdapter);
        getData();
    }

    public void getData() {
        NetworkApi.getDoctorService(new NetworkManager.SuccessCallback<ArrayList<MyServiceBean>>() {
            @Override
            public void onSuccess(ArrayList<MyServiceBean> response) {
                if (response == null){
                    return;
                }
                mServiceBean.addAll(response);
                mAdapter.notifyDataSetChanged();
            }
        });
    }
}
